// 登录
const express = require("express");
const router = express.Router();
const { loginUser } = require("../utils/sql");



router.post("/login", async (req, res) => {
  let userObj = req.body;
  const result = await loginUser(userObj);
  if (result.length > 0) {
    res.send({ code: 200, msg: "登录成功" ,data:result});
  } else {
    res.send({ code: 400, msg: "用户名或密码错误" });
  }
});

module.exports = router;
